package com.soulgame.utils;

import java.util.HashMap;
import java.util.Map;

import android.content.Context;

import com.android.volley.VolleyError;
import com.soul.sdk.utils.SGDebug;
import com.soulgame.constant.SGConstants;
import com.soulgame.sgsdkproject.sgtool.DeviceUtil;
import com.soulgame.sgsdkproject.sgtool.net.VolleyRequest;
import com.soulgame.sgsdkproject.sgtool.net.IStringHttpListener;

public class PayTask {

	public static PayTask newInstance() {
		return new PayTask();
	}

	public void doRequest(Context context, String orderId, String pProductId, String amount, String app_user_id,
			String extOrderId) {

		Map<String, String> pParams = new HashMap<String, String>();
		pParams.put("app_order_id", orderId);
		pParams.put("product_id", pProductId);
		pParams.put("amount", amount);
		pParams.put("app_user_id", app_user_id);
		pParams.put("ext", extOrderId);
		pParams.put("appKey", DeviceUtil.getAppKey(context));
		pParams.put("appVersion", DeviceUtil.getVersionName(context));
		pParams.put("imei", DeviceUtil.getIMEI(context));
		pParams.put("channel", DeviceUtil.getChannel(context));

		VolleyRequest.sendPostStringRequest(context, SGConstants.APP_SERVER_URL_PAY_START, pParams, new IStringHttpListener() {

			@Override
			public void onResponse(String response) {

				SGDebug.d("PayTask onResponse = " + response);
			}

			@Override
			public void onErrorResponse(VolleyError error) {
				SGDebug.w("PayTask onErrorResponse = " + error.getMessage());
			}
		});
	}

}
